package com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.mapper;

import com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.entities.FlowNodeTempParam;
import com.iwhalecloud.citybrain.flow.platform.manager.infrastructure.entities.FlowNodeTempParamExample;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;
import java.util.Objects;

import static org.junit.jupiter.api.Assertions.*;

@SpringBootTest
class FlowNodeTempParamDAOTest {

    @Autowired
    private FlowNodeTempParamDAO flowNodeTempParamDAO;


    @Test
    void selectByExample() {
        String processInstanceId = "9a73814ae57411eb965b00ff0cbced97";
        String nodeCode = "test3";
        FlowNodeTempParamExample flowNodeTempParamExample = new FlowNodeTempParamExample();
        flowNodeTempParamExample.createCriteria().andProcessInstanceIdEqualTo(processInstanceId).andNodeCodeEqualTo(nodeCode);
        List<FlowNodeTempParam> flowNodeTempParamList = flowNodeTempParamDAO.selectByExample(flowNodeTempParamExample);
        if (Objects.nonNull(flowNodeTempParamList) && flowNodeTempParamList.size()>0){
            System.out.println(flowNodeTempParamList.get(0).getParamCode());
            System.out.println(flowNodeTempParamList.get(0).getParamValue());
            System.out.println(flowNodeTempParamList.get(0).getParamType());
        }
    }
}